<?php
class PageStatic extends Page
	{
	///////////////////////////////////////////////////////////////////////////////
	public static function preProcess( &$page, &$template )
		{
		$template->setVarText('PAGE_CURRENT_URL',$_GET['url']);

		$f = $page->add(new Menus_Html('MYMENUS'));
		$f->setFilter('f_status>0');
		$f->setDisplayDepth(1);
		$menus = $f->getElementsByParams();
		if(is_array($menus))
			{
			foreach( $menus as $menu )
				{
				$f = $page->add(new Menus_Html( 'M_' . str_replace('-','_',strtoupper(ComportementCoded::makeCode($menu['f_label']) ))));
				$f->selectCurrentElement('id',$menu['id']);
				$f->setDisplayDepth(1);
				}
			}

		$f = $page->add(new Menus_Html('HIDDENMENUS'));
		$f->setFilter('f_status!=1');
		$f->setDisplayDepth(1);
		$menus = $f->getElementsByParams();
		if(is_array($menus))
			{
			foreach( $menus as $menu )
				{
				$f = $page->add(new Menus_Html( 'M_' . str_replace('-','_',strtoupper(ComportementCoded::makeCode($menu['f_label']) ))));
				$f->selectCurrentElement('id',$menu['id']);
				$f->setDisplayDepth(1);
				}
			}

		$f = $page->add(new Blocks_Html('MYBLOCKS'));
		if(isset($page->page))
			$f->setFilter('f_status>0 and (f_page_id is null or f_page_id<=0 or f_page_id=' . $page->page['id'] . ') and f_target_page_id!=' . $page->page['id']);
		else
			$f->setFilter('f_status>0 and (f_page_id is null or f_page_id<=0)');
		$f->setDisplayDepth(1);
		$blocks = $f->getElementsByParams();
		if(is_array($blocks))
			{
			foreach( $blocks as $block )
				{
				$f = $page->add(new Blocks_Html( 'B_' . strtoupper($block['f_code'])));
				$f->selectCurrentElement('id',$block['id']);
				$f->setDisplayDepth(1);
				}
			}

		$f = $page->add(new Blocks_Html('HIDDENBLOCKS'));
		$f->setFilter('f_status!=1 and (f_page_id is null or f_page_id<=0)');
		$f->setDisplayDepth(1);
		$blocks = $f->getElementsByParams();
		if(is_array($blocks))
			{
			foreach( $blocks as $block )
				{
				$f = $page->add(new Blocks_Html( 'B_' . strtoupper($block['f_code'])));
				$f->selectCurrentElement('id',$block['id']);
				$f->setDisplayDepth(1);
				}
			}
		}
	
	///////////////////////////////////////////////////////////////////////////////
	public function __construct( $build = true, $fabrique = null, $url )
		{
		$this->m_url = $url;
		parent::__construct( $build, $fabrique );
		}
	
	protected function build()	{}
	protected function getPageUrl() { return $this->m_url; }
	protected function getBreadcrumbTitle() { return ''; }
	protected function getPageParent() { return ''; }
	protected function getTemplateFilename() { return $this->m_url; }
	public function handleEvent( $event, $source, $params ) {parent::handleEvent( $event, $source, $params );}
	protected function _process( $processor = null, $ret = false ) {return $ret;}
	}
?>